<!DOCTYPE html>
<html xmlns:layout="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org"
	layout:decorate="~{common/layout}">

<head>
	<meta charset="UTF-8">
	<title>血糖记录管理系统</title>
	<style scoped lang="less">
		
	</style>
</head>

<body>
	<div layout:fragment="fragment_body">
		<van-row>
			<van-nav-bar
			  title="食物列表"
			  left-text="返回"
			  left-arrow
			  @click-left="onClickLeft"
			/>
		</van-row>
		<van-row>
		<van-empty v-if="foods == null || foods.length == 0" description="暂无食物列表" ></van-empty>
		</van-row>
		<van-row>
			<van-card
			   v-for="(food, index) in foods" 
			   :key="index"
			  :desc="food.foodCalorie + '千卡'"
			  :title="food.foodTitle"
			>
			<template #num></template>
			<template #thumb>
				<van-image contain round width="3rem" height="3rem" :src="food.foodImg" ></van-image>
			</template>
			<template #price>
				{{food.foodCarbon}}碳水/{{food.foodKg}}克
			</template>
			</van-card>
		</van-row>
	</div>
</body>
<script type="text/javascript" layout:fragment="fragment_script">
	let vueData = {
		foods: []
	}
	let vueComputed = {

	}
	let vueMethods = {
		getFoods() {
			let that = this
			let foodTypeId = urlParam('tid')
			let pp = {
				foodTypeId: foodTypeId
			}
			postRequst('/getFoods', pp, true).then(function (resp) {
				that.foods = resp.rows
			})
		},
		onClickLeft(){
			window.location.href='/user/home'
		}
	}
	function vueCreated() {
		let that = this
		that.getFoods()
	}
</script>

</html>